package club.baimahu.pencil.miaosha.service;

import club.baimahu.pencil.base.ServerConstant;
import club.baimahu.pencil.util.IdWorker;
import org.springframework.stereotype.Component;

/**
 * 雪花算法生成器
 *
 * @author zhanghongjiang
 * @version 1.0
 * @date 2021/9/16 15:09
 */
@Component
public class IdWorkerService {

    private static final IdWorker idWorker = new IdWorker(ServerConstant.workId, ServerConstant.datacenterId,1);

    public long nextId(){
        return idWorker.nextId();
    }
}
